package com.farm.shop.dao;


import com.farm.shop.domain.FarmDishDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 菜品
 *
 * @author chglee
 * @email 1992lcg@163.com
 * @date 2019-09-06 19:44:49
 */
@Mapper
public interface FarmDishDao {

    FarmDishDO get(Long id);

    List<FarmDishDO> list(Map<String, Object> map);

    int count(Map<String, Object> map);

    int save(FarmDishDO farmDish);

    int update(FarmDishDO farmDish);

    int remove(Long id);

    int batchRemove(Long[] ids);

    /**
     * Search 查询条件 关键字 dishName  dishDescribe 模糊查询
     *
     * @param keyword 关键字
     * @return List<FarmDishDO>
     */
    @Select(value = "SELECT * FROM farm_dish WHERE dish_name LIKE '%${keyword}%' or dish_describe LIKE '%${keyword}%'")
    List<FarmDishDO> search(@Param("keyword") String keyword);

    List<FarmDishDO> searchName(Map<String, Object> map);

    int searchNameCount(Map<String, Object> map);
}
